<?php

include_once "src/controller/dbmanagement/DBManager.php";
include_once "src/regexception/DBConnectionException.php";
include_once "src/regexception/DBException.php";
include_once "src/regexception/GeneralRegistryException.php";

class MiscellaneousManager {

    public static function getServices() {
        $services = NULL;
        try {
            $services = DBManager::getServices();
        } catch (GeneralRegistryException $e) {
            throw $e;
        } catch (DBException $e) {
            throw $e;
        } catch (DBConnectionException $e) {
            throw $e;
        }
        return $services;
    }

    public static function deleteService($serviceId) {
        try {
            $services = AdminDBManager::deleteService($serviceId);
        } catch (GeneralRegistryException $e) {
            throw $e;
        } catch (DBException $e) {
            throw $e;
        } catch (DBConnectionException $e) {
            throw $e;
        }
        return true;
    }

    public static function updateService($serviceId, $serviceName) {
        try {
            $services = AdminDBManager::updateService($serviceId, $serviceName);
        } catch (GeneralRegistryException $e) {
            throw $e;
        } catch (DBException $e) {
            throw $e;
        } catch (DBConnectionException $e) {
            throw $e;
        }
        return true;
    }

    public static function getStates() {
        $states = NULL;
        try {
            $states = DBManager::getStates();
        } catch (GeneralRegistryException $e) {
            throw $e;
        } catch (DBException $e) {
            throw $e;
        } catch (DBConnectionException $e) {
            throw $e;
        }
        return $states;
    }

    public static function getStateName($stateId) {
        $stateName = "";
        try {
            $stateName = DBManager::getStateName($stateId);
        } catch (GeneralRegistryException $e) {
            throw $e;
        } catch (DBException $e) {
            throw $e;
        } catch (DBConnectionException $e) {
            throw $e;
        }
        return $stateName;
    }

    public static function getServiceName($serviceId) {
        $stateName = "";
        try {
            $stateName = DBManager::getServiceName($serviceId);
        } catch (GeneralRegistryException $e) {
            throw $e;
        } catch (DBException $e) {
            throw $e;
        } catch (DBConnectionException $e) {
            throw $e;
        }
        return $stateName;
    }

}
?>
